package com.htl.String方法;

import java.util.Arrays;
import java.util.List;

public class StringFun {
    public static void main(String[] args) {
        String values = "p1.png,p2.png,p3.png";
        String[] list = values.split(",");
        List<String> stringList = Arrays.asList(list);
        System.out.println(stringList.get(0));// p1.png
        System.out.println(stringList.get(1));// p2.png
        System.out.println(stringList.get(2));// p3.png

        String str = "hello world!";
        System.out.println(str.substring(1));// ello world!
        System.out.println(str.substring(3));// lo world!
        System.out.println(str.substring(6));// world!

        String str1 = "abcdefghijklmnabc";
        System.out.println(str1.indexOf("c")); //结果为2，为字符"c"第一次出现的位置
        System.out.println(str1.indexOf("x")); //结果为-1，没有找到字符"x"

    }
}
